<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>H+ 后台主题UI框架 - 登录</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">

    <link rel="shortcut icon" href="img/favicon.ico">
    <link href="css/hplus/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="css/hplus/font-awesome.min.css?v=4.4.0" rel="stylesheet">

    <link href="css/animate.min.css" rel="stylesheet">
    <link href="css/hplus/style.min.css?v=4.1.0" rel="stylesheet">
</head>

<body class="gray-bg">
    <div class="middle-box text-center loginscreen animated fadeInDown">
        <div>
            <div>
                <h1 class="logo-name">H+</h1>
            </div>
            <h3>欢迎使用 H+</h3>
            <form class="m-t" role="form" id="form">
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="用户名" required="" v-model="loginName">
                </div>
                <div class="form-group">
                    <input type="password" class="form-control" placeholder="密码" required="" v-model="password">
                </div>
                <input class="btn btn-primary block full-width m-b" @click="login1()" value="登 录">
                <p class="text-muted text-center"> <a href="login.html#"><small>忘记密码了？</small></a> | <a href="register.html">注册一个新账号</a>
                </p>
            </form>
        </div>
    </div>
    <script src="js/jquery/jquery.min.js?v=2.1.4"></script>
    <script src="js/bootstrap/bootstrap.min.js?v=3.3.6"></script>
    <script src="js/vue/vue.min.js"></script>
    <!-- 自定义 -->
    <script src="js/build/gAjax.js"></script>
    <script>
        var loginVM = new Vue({
            el : '#form',
            data: {
                "loginName": "",
                "password": ""
            },
            methods: {
                login : function() {
                    if(loginVM.loginName == "admin" && loginVM.password == "123456") {
                        window.location.href = "views/index.html";
                        window.event.returnValue = false;
                    } else {
                        alert("用户名密码错误！");
                    }
                },
                login2 : function() {
                    /*
                    $.ajax({
                        url: 'http://localhost:8087/demo/user/query/unique',
                        type: 'POST', //GET
                        async: true,    //或false,是否异步
                        timeout: 5000,    //超时时间
                        dataType: 'json',    //返回的数据格式：json/xml/html/script/jsonp/text
                        success: function (data, textStatus, jqXHR) {
                            console.log(JSON.stringify(data))
                            console.log(textStatus)
                            console.log(jqXHR)
                        }
                    });*/
                },
                login1 : function() {
                    var ajax_ = {
                        params : {"fUserName": loginVM.loginName, "fPassword": loginVM.password},
                        url : "user/query/unique"
                    };
                    gAjax.req(ajax_).then(function (data) {
                        alert(JSON.stringify(data));
                        /**
                         * 将当前登录人放入浏览器缓存中
                         */
                        gAjax.storeMemory("login_user", data);
                        console.log(JSON.stringify(data));

                        //window.location.href="views/index.html";
                       // window.event.returnValue = false;

                    });
                }

            }
        });
    </script>
</body>

</html>
